package com.tjoydoorsystem.receiver;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;

import com.tjoydoorsystem.main.WelcomeActivity;

/**
 * Created by hebin
 * on 2017/3/24 0024.  开机收到通知
 */

public class BootReceiver extends BroadcastReceiver {

    static final String ACTION = "android.intent.action.BOOT_COMPLETED";

    @Override
    public void onReceive(Context context, Intent intent) {
        if (intent.getAction().equals(ACTION)) {
            Log.i("TAG", "开机自启动");
            Intent mainActivityIntent = new Intent(context, WelcomeActivity.class);  // 要启动的Activity  
            mainActivityIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            context.startActivity(mainActivityIntent);
        }
    }

}  
